import React, { Component } from 'react'
import ThemeContext from './context/theme-context'
import UserContext from './context/user-context'
export class HomeInfo extends Component {
  render() {
    // 4.获取数据  使用数据
    console.log(this.context)
    return (
      <div style={{...this.context}}>
        HomeInfo:{this.context.color}
      
        <div>
          <UserContext.Consumer>
            {
              value =>{
                return <h2>info User :{
                  value.nickname
                  }</h2>
              }
            }
          </UserContext.Consumer>
        </div>
      </div>
    )
  }
}
// 3.第三步操作: 设置组件的contextType 为某一个Context
HomeInfo.contextType = ThemeContext
export default HomeInfo